#include <stdio.h>
int main()
{
	char want=getchar(),c;
	int ans=0;
	while((c=getchar())!=EOF)
		ans+=c==want;
	printf("%d\n",ans);
	return 0;
}